#include "UDPSocket.h"
#include "Translate.h"



CUDPSocket::CUDPSocket()
{
}


CUDPSocket::CUDPSocket(const CUDPSocket &__instance)
{
}


CUDPSocket& CUDPSocket::operator = (const CUDPSocket &__instance)
{
	return *this;
}


int CUDPSocket::Send(const std::string strMSG)
{
	static int nLength = sizeof(sockaddr_in);
	return SOCKET_UDP_SEND(m_nSocket_fd, strMSG.c_str(), strMSG.size(), 0, (sockaddr*)&m_addrHost, nLength);
}


int CUDPSocket::Recv(std::string &strMSG)
{
	char cBuff[NETDEBUG_BUFF_SIZE];
	memset(cBuff, 0, NETDEBUG_BUFF_SIZE);
	static SOCKLEN_T nLength = sizeof(sockaddr_in);
	int nRet = SOCKET_UDP_RECV(m_nSocket_fd, cBuff, NETDEBUG_BUFF_SIZE, 0, (sockaddr*)&m_addrHost, &nLength);
	if (0 <= nRet)
	{
		strMSG = cBuff;
	}
	return nRet;
}